using System.Collections.Generic;

namespace ExcelTemplateEngine.OpenXML
{
    /// <summary>
    /// Excel工作表接口
    /// </summary>
    public interface IWorksheet
    {
        /// <summary>
        /// 工作表名称
        /// </summary>
        string Name { get; set; }
        
        /// <summary>
        /// 获取单元格
        /// </summary>
        /// <param name="address">单元格地址，如"A1"</param>
        /// <returns>单元格对象</returns>
        ICell GetCell(string address);
        
        /// <summary>
        /// 获取单元格
        /// </summary>
        /// <param name="row">行号（1-based）</param>
        /// <param name="column">列号（1-based）</param>
        /// <returns>单元格对象</returns>
        ICell GetCell(int row, int column);
        
        /// <summary>
        /// 获取范围内的所有单元格
        /// </summary>
        /// <param name="range">范围地址，如"A1:B10"</param>
        /// <returns>单元格集合</returns>
        IEnumerable<ICell> GetCells(string range);
        
        /// <summary>
        /// 插入行
        /// </summary>
        /// <param name="startRow">起始行号（1-based）</param>
        /// <param name="count">插入行数</param>
        void InsertRows(int startRow, int count);
        
        /// <summary>
        /// 插入列
        /// </summary>
        /// <param name="startColumn">起始列号（1-based）</param>
        /// <param name="count">插入列数</param>
        void InsertColumns(int startColumn, int count);
        
        /// <summary>
        /// 删除行
        /// </summary>
        /// <param name="startRow">起始行号（1-based）</param>
        /// <param name="count">删除行数</param>
        void DeleteRows(int startRow, int count);
        
        /// <summary>
        /// 删除列
        /// </summary>
        /// <param name="startColumn">起始列号（1-based）</param>
        /// <param name="count">删除列数</param>
        void DeleteColumns(int startColumn, int count);
        
        /// <summary>
        /// 获取最大行号
        /// </summary>
        int MaxRow { get; }
        
        /// <summary>
        /// 获取最大列号
        /// </summary>
        int MaxColumn { get; }
        
        /// <summary>
        /// 合并单元格
        /// </summary>
        /// <param name="range">合并范围，如"A1:B2"</param>
        void MergeCells(string range);
        
        /// <summary>
        /// 取消合并单元格
        /// </summary>
        /// <param name="range">取消合并的范围</param>
        void UnmergeCells(string range);
        
        /// <summary>
        /// 获取所有合并区域
        /// </summary>
        /// <returns>合并区域地址集合</returns>
        IEnumerable<string> GetMergedRegions();
    }
}